<?php $myCartObj = new Cart(); $myCartInfo = $myCartObj->getMyCart();$siteConfig=new Config("site_config");?>
<?php $siteConfigObj = new Config("site_config");$site_config   = $siteConfigObj->getInfo();?>
<?php $iurl = IUrl::creatUrl();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $siteConfig->name;?></title>
<link rel="stylesheet" href="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/css/index.css";?>" />
<script type='text/javascript' src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/javascript/common.js";?>"></script>
<script charset="UTF-8" src="/runtime/systemjs/jquery-1.4.4.min.js"></script>
<script charset="UTF-8" src="/runtime/systemjs/form.js"></script>
<script charset="UTF-8" src="/runtime/systemjs/artdialog/artDialog.min.js"></script>
<link rel="stylesheet" type="text/css" href="/runtime/systemjs/autovalidate/style.css"/><script charset="UTF-8" src="/runtime/systemjs/autovalidate/validate.js"></script>
</head>
<body class="index">
<div class="ucenter container">
	<div class="header">
		<h1 class="logo"><a title="<?php echo $siteConfig->name;?>" style="background:url(<?php echo IUrl::creatUrl("")."image/logo.gif";?>);" href="<?php echo IUrl::creatUrl("");?>"><?php echo $siteConfig->name;?></a></h1>
		<ul class="shortcut">
			<li class="first"><a href="<?php echo IUrl::creatUrl("/ucenter/index");?>">我的账户</a></li><li><a href="<?php echo IUrl::creatUrl("/ucenter/order");?>">我的订单</a></li><li class='last'><a href="<?php echo IUrl::creatUrl("/site/help_list");?>">使用帮助</a></li>
		</ul>
		<?php $user = $this->user;?>
		<p class="loginfo"><?php echo isset($user['username'])?$user['username']:"";?>您好，欢迎您来到<?php echo $siteConfig->name;?>购物！[<a class='reg' href="<?php echo IUrl::creatUrl("/simple/logout");?>">安全退出</a>]</p>
	</div>
	<div class="navbar">
		<ul>
			<li><a href="<?php echo IUrl::creatUrl("");?>">首页</a></li>
			<?php $query = new IQuery("guide");$items = $query->find(); foreach($items as $key => $item){?>
			<li><a href="<?php echo isset($item['link'])?$item['link']:"";?>"><?php echo isset($item['name'])?$item['name']:"";?><span> </span></a></li>
			<?php }?>
		</ul>
		<div class="mycart">
			<dl>
				<dt><a href="<?php echo IUrl::creatUrl("/simple/cart");?>">购物车<b name="mycart_count"><?php echo isset($myCartInfo['count'])?$myCartInfo['count']:"";?></b>件</a></dt>
				<dd><a href="<?php echo IUrl::creatUrl("/simple/cart");?>">去结算</a></dd>
			</dl>

			<!--购物车浮动div 开始-->
			<div class="shopping" id='div_mycart' style='display:none;'>
			</div>
			<!--购物车浮动div 结束-->

		</div>
	</div>

	<div class="searchbar">
		<div class="allsort">
			<a href="javascript:void();">全部商品分类</a>

			<!--总的商品分类-开始-->
			<ul class="sortlist" id='div_allsort' style='display:none'>
				<?php $catResult = block::goods_category();?>
				<?php foreach($catResult as $key => $first){?>
					<li>
						<h2><a href="<?php echo IUrl::creatUrl("/site/pro_list/cat/$first[id]");?>"><?php echo isset($first['name'])?$first['name']:"";?></a></h2>

						<!--商品分类 浮动div 开始-->
						<div class="sublist" style='display:none'>

							<div class="items">
								<strong>选择分类</strong>
								<?php if(isset($first['second'])){?>
								<?php foreach($first['second'] as $key => $second){?>
								<dl class="category selected">
									<dt>
										<a href="<?php echo IUrl::creatUrl("/site/pro_list/cat/$second[id]");?>"><?php echo isset($second['name'])?$second['name']:"";?></a>
									</dt>

									<dd>
										<?php if(isset($second['more'])){?>
										<?php foreach($second['more'] as $key => $third){?>
										<a href="<?php echo IUrl::creatUrl("/site/pro_list/cat/$third[id]");?>"><?php echo isset($third['name'])?$third['name']:"";?></a>|
										<?php }?>
										<?php }?>
									</dd>
								</dl>
								<?php }?>
								<?php }?>

							</div>

						</div>
						<!--商品分类 浮动div 结束-->

					</li>
				<?php }?>

			</ul>
			<!--总的商品分类-结束-->

		</div>

		<div class="searchbox">

			<form method='get'>
				<input type='hidden' name='controller' value='site' />
				<input type='hidden' name='action' value='search_list' />
				<?php $word = IReq::get('word');?>
				<input class="text" type="text" name='word' id="word" autocomplete="off" value="<?php echo $word ? $word : '输入关键字...';?>" />
				<input class="btn" type="submit" value="商品搜索" onclick="checkInput('word','输入关键字...');" />
			</form>

			<!--自动完成div 开始-->
			<ul class="auto_list" style='display:none'></ul>
			<!--自动完成div 开始-->

		</div>
		<div class="hotwords">热门搜索：
			<?php $query = new IQuery("keyword");$query->where = "hot = 1";$query->limit = "5";$query->order = "`order` asc";$items = $query->find(); foreach($items as $key => $item){?>
			<?php $tmpWord = urlencode($item['word']);?>
			<a href="<?php echo IUrl::creatUrl("/site/search_list/word/$tmpWord");?>"><?php echo isset($item['word'])?$item['word']:"";?></a>
			<?php }?>
		</div>
	</div>

	<div class="position">
		您当前的位置： <a href="<?php echo IUrl::creatUrl("");?>">首页</a>&nbsp;&gt;&nbsp;我的账户
	</div>
	<div class="wrapper clearfix">
		<div class="sidebar f_l">
			<img src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/images/front/ucenter/ucenter.gif";?>" width="180" height="40" />
			<div class="box">
				<div class="title"><h2>交易记录</h2></div>
				<div class="cont">
					<ul class="list">
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/order");?>">我的订单</a></li>
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/integral");?>">我的积分</a></li>
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/redpacket");?>">我的代金券</a></li>
					</ul>
				</div>
			</div>
			<div class="box">
				<div class="title"><h2 class='bg2'>服务中心</h2></div>
				<div class="cont">
					<ul class="list">
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/refunds");?>">退款申请</a></li>
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/complain");?>">站点建议</a></li>
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/consult");?>">商品咨询</a></li>
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/evaluation");?>">商品评价</a></li>
					</ul>
				</div>
			</div>
			<div class="box">
				<div class="title"><h2 class='bg3'>应用</h2></div>
				<div class="cont">
					<ul class="list">
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/message");?>">短信息</a></li>
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/favorite");?>">收藏夹</a></li>
					</ul>
				</div>
			</div>
			<div class="box">
				<div class="title"><h2 class='bg4'>账户资金</h2></div>
				<div class="cont">
					<ul class="list">
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/account_log");?>">帐户余额</a></li>
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/online_recharge");?>">在线充值</a></li>
					</ul>
				</div>
			</div>
			<div class="box">
				<div class="title"><h2 class='bg5'>个人设置</h2></div>
				<div class="cont">
					<ul class="list">
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/address");?>">地址管理</a></li>
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/info");?>">个人资料</a></li>
						<li><a href="<?php echo IUrl::creatUrl("/ucenter/password");?>">修改密码</a></li>
					</ul>
				</div>
			</div>
		</div>
				<?php $item = $this->order_info;?>
        <div class="main f_r">
			<div class="uc_title m_10">
				<label class="current"><span>订单详情</span></label>
			</div>
			<div class="prompt_2 m_10">
				<div class="t_part">
					<p><?php echo isset($item['create_time'])?$item['create_time']:"";?>&nbsp;&nbsp;<span class="black">订单创建</span></p>
                    <?php if($item['pay_status']>0){?>
					<p><?php echo isset($item['pay_time'])?$item['pay_time']:"";?>&nbsp;&nbsp;<span class="black">订单<?php echo isset($item['order_no'])?$item['order_no']:"";?> 付款<b><?php echo isset($item['order_amount'])?$item['order_amount']:"";?></b></span></p>
                    <?php }?>
                    <?php if($item['distribution_status']>0){?>
					<p><?php echo isset($item['send_time'])?$item['send_time']:"";?>&nbsp;&nbsp;<span class="black">订单<b class="orange">全部商品</b>发货完成</span></p>
                    <?php }?>
                    <?php if($item['status']==5){?>
					<p><?php echo isset($item['completion_time'])?$item['completion_time']:"";?>&nbsp;&nbsp;<span class="black">订单完成</span></p>
                    <?php }?>
				</div>
				<p><b>订单号：</b><?php echo isset($item['order_no'])?$item['order_no']:"";?><b>下单日期：</b><?php echo isset($item['create_time'])?$item['create_time']:"";?><b>状态：</b><span class="red2">
                <?php if($item['status']==1){?>
                    <?php if($item['pay_type'] == 0){?>
                    <b class="orange">等待确认</b>
                    <?php }else{?>
                    <b class="orange">等待付款</b>
                    <?php }?>
                <?php }elseif($item['status']==2){?>
                    <?php if($item['distribution_status']==1){?>
                    <b class="green">已发货</b>
                    <?php }else{?>
                    <b class="orange">等待发货</b>
                    <?php }?>
                <?php }elseif($item['status']==3 || $item['status']==4){?>
                    <b class="green">已取消</b>
                <?php }elseif($item['status']==5){?>
                    <b class="green">已完成</b>
                    <?php if($item['pay_status']==2){?>
                        <b class="green">已退款</b>
                    <?php }elseif($item['pay_status']==3){?>
                        <b class="green">已申请退款</b>
                    <?php }?>
                    <?php if($item['distribution_status']==2){?>
                        <b class="green">已退货</b>
                    <?php }elseif($item['distribution_status']==3){?>
                        <b class="green">已申请退货</b>
                    <?php }?>
                <?php }?></span></p>
                <form action='<?php echo IUrl::creatUrl("/ucenter/order_status");?>' method='post' <?php if($item['status']==1 && $this->pay_type==1){?>target='_blank'<?php }?>>
				<p>
                <input name="id" value="<?php echo IReq::get('id');?>" type="hidden"/>
                <?php if($item['status']==1){?>
                    <?php if($this->pay_status==0){?>
                    <label class="btn_orange"><input type="hidden" name='op' value='cancel'></input><input type="submit" value="取消订单" /></label>
                    <?php }?>
                    <?php if($this->pay_type==1){?>
					<label class="btn_green"><input type="button" value="立即付款" onclick="window.location.href='<?php echo IUrl::creatUrl("/block/doPay/order_id/$item[id]/id/$item[pay_type]");?>'" /></label>
                    <?php }?>
                <?php }elseif($item['status']==2){?>
                    <?php if($item['distribution_status']==1 && $item['pay_type']!=0){?>
                    <label class="btn_green"><input type="hidden" name='order_no' value='<?php echo isset($item['order_no'])?$item['order_no']:"";?>'><input type="hidden" name='op' value='confirm'><input type="submit" value="确认收货" /></label>
                    <?php }?>
                <?php }elseif($item['status']==5){?>
                    <?php if($item['pay_status']!=2 && $item['pay_status']!=3 && (time()-strtotime($item['completion_time'])) < 604800 ){?>
                    <label class="btn_orange"><input type="button" value="申请退款" onclick='javascript:window.location.href="<?php echo IUrl::creatUrl("/ucenter/refunds/order_no/$item[order_no]");?>"' /></label>
                    <?php }?>
                <?php }?>
                <?php if($item['distribution_status']==1 && $item){?>
                	<?php $sUrl = $this->module->getBasePath().'plugins/freight/company.php';?>
                	<?php if(file_exists ($sUrl) && $this->is_open=='0'){?>
					<label class="btn_orange"><input type="button" value="快递跟踪" onclick="exdelivry('<?php echo isset($item['id'])?$item['id']:"";?>')" /></label>
					<?php }?>
				<?php }?>
                </p>
                </form>
			</div>
			<div class="box m_10">
				<div class="title"><h2><span class="orange">收件人信息</span></h2><?php if($item['pay_status']==0 || $item['status']>2){?><span style="float:right;margin-right:10px" id="accept_state"><a href="javascript:void(0);" onclick="return update();">修改</a>&nbsp;</span><?php }?></div>
				<div class="cont clearfix" id="accept">
					<table class="dotted_table f_l" width="100%" cellpadding="0" cellspacing="0">
						<col width="129px" />
						<col />
						<tr>
							<th>收 货 人：</th>
							<td><?php echo isset($item['accept_name'])?$item['accept_name']:"";?></td>
						</tr>
						<tr>
							<th>地&nbsp;&nbsp;&nbsp;&nbsp;址：</th>
							<td><?php echo isset($this->area[$item['province']])?$this->area[$item['province']]:"";?><?php echo isset($this->area[$item['city']])?$this->area[$item['city']]:"";?><?php echo isset($this->area[$item['area']])?$this->area[$item['area']]:"";?><?php echo isset($item['address'])?$item['address']:"";?></td>
						</tr>
						<tr>
							<th>固定电话：</th>
							<td><?php echo isset($item['telphone'])?$item['telphone']:"";?></td>
						</tr>
						<tr>
							<th>手机号码：</th>
							<td><?php echo isset($item['mobile'])?$item['mobile']:"";?></td>
						</tr>
					</table>
				</div>
				<div class="cont clearfix" id="accept_text" style="display:none;">
					<form method="post" action="<?php echo IUrl::creatUrl("/ucenter/order_accept");?>" name="modelForm">
						<table class="dotted_table f_l" width="100%" cellpadding="0" cellspacing="0">
						<col width="129px" />
						<col />
						<tr>
							<th>收 货 人：<input type="hidden" name="freight_real" id="freight_real" value="<?php echo isset($item['real_freight'])?$item['real_freight']:"";?>"/><input type="hidden" name="order_total" id="order_total" value="<?php echo isset($item['order_amount'])?$item['order_amount']:"";?>"/></th>
							<td><input class="normal" type="text" id="accept_name" name="accept_name" pattern="required" value="<?php echo isset($item['accept_name'])?$item['accept_name']:"";?>" alt="收货人姓名错误"/><label>收货人姓名</label><input type="hidden" name="order_id" value="<?php echo isset($item['id'])?$item['id']:"";?>"/></td>
						</tr>
						<tr>
							<th>地址地区：</th>
							<td><select name="province" id="province" onchange="select_city(this.value,2);">
								<option value="">请选择省份</option>
								<?php $query = new IQuery("areas");$query->where = "parent_id = 0";$items = $query->find(); foreach($items as $key => $area){?>
								<option value="<?php echo isset($area['area_id'])?$area['area_id']:"";?>,<?php echo isset($area['area_name'])?$area['area_name']:"";?>" <?php if($item['province']==$area['area_id']){?>selected<?php }?>><?php echo isset($area['area_name'])?$area['area_name']:"";?></option>
								<?php }?>
								</select><span id="selec2"></span><span id="selec3"></span><span id="not"></span>
							</td>
						</tr>
						<tr>
							<th>地&nbsp;&nbsp;&nbsp;&nbsp;址：</th>
							<td><input class="normal" type="text" id="address" name="address" pattern="required" value="<?php echo isset($item['address'])?$item['address']:"";?>" alt="收货地址错误"/><label>收货地址</label></td>
						</tr>
						<tr>
							<th>固定电话：</th>
							<td><input class="normal" type="text" id="telphone" name="telphone" empty pattern="phone" value="<?php echo isset($item['telphone'])?$item['telphone']:"";?>" alt="请输入正确的联系电话"/><label>联系电话</label></td>
						</tr>
						<tr>
							<th>手机号码：</th>
							<td><input class="normal" type="text" id="mobile" name="mobile" empty pattern="mobi" maxlength="11" value="<?php echo isset($item['mobile'])?$item['mobile']:"";?>" alt="手机号码错误"/><lable></lable></td>
						</tr>
						<tr>
							<th></th><td colspan="2"><label class="btn"><input type="submit" value="保存" /></label></td>
						</tr>
						</table>
					</form>
				</div>
			</div>
			<div class="box m_10">
				<div class="title"><h2><span class="orange">支付及配送方式</span></h2></div>
				<div class="cont clearfix">
					<table class="dotted_table f_l" width="100%" cellpadding="0" cellspacing="0">
						<col width="129px" />
						<col />
						<tr>
							<th>支付方式：</th>
							<td><?php echo isset($this->pay_name)?$this->pay_name:"";?></td>
						</tr>

						<?php if(isset($this->pay_note) && $this->pay_note != ''){?>
						<tr>
							<th>支付说明：</th>
							<td><span id="freight"><?php echo isset($this->pay_note)?$this->pay_note:"";?></span></td>
						</tr>
						<?php }?>

						<tr>
							<th>运费：</th>
							<td><span id="freight"><?php echo isset($item['real_freight'])?$item['real_freight']:"";?></span></td>
						</tr>
						<tr>
							<th>物流公司：</th>
							<td><span id="freight"><?php echo isset($this->deliver_name)?$this->deliver_name:"";?></span></td>
						</tr>
						<tr>
							<th>快递单号：</th>
							<td><span id="freight"><?php echo isset($this->deliver_code)?$this->deliver_code:"";?></span></td>
						</tr>
					</table>
				</div>
			</div>
            <?php $taxes=0;?>
            <?php if($item['invoice']==1){?>
			<div class="box m_10">
				<div class="title"><h2><span class="orange">发票信息</span></h2></div>
				<div class="cont clearfix">
					<table class="dotted_table f_l" width="100%" cellpadding="0" cellspacing="0">
						<col width="129px" />
						<col />
						<tr>
							<th>所需税金：</th>
							<td><?php $taxes=$item['taxes'];?><?php echo isset($item['taxes'])?$item['taxes']:"";?></td>
						</tr>
						<tr>
							<th>发票抬头：</th>
							<td><?php echo isset($item['invoice_title'])?$item['invoice_title']:"";?></td>
						</tr>
					</table>
				</div>
			</div>
            <?php }?>
			<div class="box m_10">
				<div class="title"><h2><span class="orange">商品清单</span></h2></div>

				<div class="cont clearfix">
					<table class="list_table f_l" width="100%" cellpadding="0" cellspacing="0">
						<tbody>
							<tr>
								<th>图片</th><th>商品名称</th><th>赠送积分</th><th>商品价格</th><th>优惠金额</th><th>商品数量</th><th>小计</th>
							</tr>
                            <?php $total=0;$item_total=0;$point=0;$order_id=$item['id'];$weight=0;?>
                            <?php $query = new IQuery("order_goods as o");$query->join = "left join goods as go on o.goods_id = go.id";$query->where = "o.order_id = $order_id";$items = $query->find(); foreach($items as $key => $good){?>
                            <?php $good_info=unserialize($good['goods_array']);$weight += $good['goods_nums']*$good['goods_weight'];?>
							<tr>
								<td><img class="pro_pic" src="<?php echo IUrl::creatUrl("")."$good[list_img]";?>" width="50" height="50" onerror='this.src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/images/front/nopic_100_100.gif";?>"' /></td>
								<td class="t_l"><a class="blue" href="<?php echo IUrl::creatUrl("/site/products/id/$good[id]");?>" target='_blank'><?php if($good_info['value']!=''){?><?php echo isset($good_info['name'])?$good_info['name']:"";?><?php }else{?><?php echo isset($good['name'])?$good['name']:"";?><?php }?></a><?php if($good_info['value']!=''){?><br />&nbsp;&nbsp;<?php echo isset($good_info['value'])?$good_info['value']:"";?><?php }?></td>
								<td><?php $point += $good['point']?><?php echo isset($good['point'])?$good['point']:"";?></td>
								<td class="red2">￥<?php echo isset($good['goods_price'])?$good['goods_price']:"";?></td>
								<td class="red2">￥<?php echo sprintf("%01.2f",(($good['goods_price']-$good['real_price'])));?></td>
								<td>x<?php echo isset($good['goods_nums'])?$good['goods_nums']:"";?></td>
								<td class="red2 bold">￥<?php $item_total = ($good['real_price']*$good['goods_nums']); $total += $item_total;?><?php echo sprintf("%01.2f",$item_total);?></td>
							</tr>
                            <?php }?>
						</tbody>
					</table>
				</div>
			</div>
			<div class="gray_box">
				<div class="t_part">
					<p>商品总金额：￥<?php echo isset($item['payable_amount'])?$item['payable_amount']:"";?></p>
					<p>+ 运费：￥<span id="real_freight"><?php echo isset($item['real_freight'])?$item['real_freight']:"";?></span></p>
                    <?php if($taxes>0){?><p>+ 税金：￥<?php echo isset($taxes)?$taxes:"";?><?php $total+=$taxes;?></p><?php }?>
                    <?php if($item['pay_fee']>0){?><p>+ 支付手续费：￥<?php echo isset($item['pay_fee'])?$item['pay_fee']:"";?></p><?php }?>
                    <?php if($item['discount']>0){?><p>订单折扣或涨价：￥<?php echo isset($item['discount'])?$item['discount']:"";?></p><?php }?>
                    <p>- 促销优惠金额：￥<?php echo isset($item['promotions'])?$item['promotions']:"";?></p>
				</div>
				<div class="b_part">
					<p>订单支付金额：<span class="red2" id="red2">￥<?php echo isset($item['order_amount'])?$item['order_amount']:"";?></span></p>
				</div>
			</div>
		</div>
<script type="text/javascript">
function exdelivry(id)
{
	var tempUrl = '<?php echo IUrl::creatUrl("/block/exdelivry/id/@id@");?>';
		tempUrl = tempUrl.replace('@id@',id);
	art.dialog.open(tempUrl,{
		id:'exdelivry',
		width:'700px',
		height:'500px',
	    title: '快递跟踪'
	});
}
var province_va = '';
var city_va = '';
var area_va = '';
<?php if($item['province']!=''){?>
province_va = '<?php echo isset($item['province'])?$item['province']:"";?>'+','+'<?php echo isset($this->area[$item['province']])?$this->area[$item['province']]:"";?>';
city_va = '<?php echo isset($item['city'])?$item['city']:"";?>'+','+'<?php echo isset($this->area[$item['city']])?$this->area[$item['city']]:"";?>';
area_va = '<?php echo isset($item['area'])?$item['area']:"";?>'+','+'<?php echo isset($this->area[$item['area']])?$this->area[$item['area']]:"";?>';
<?php }?>
function update()
{
	if(city_va!='')
	{
		select_city(province_va,'2');
	}
	if(area_va!='')
	{
		select_city(city_va,'3');
	}
	$('#accept').hide();
	$('#accept_text').show();
}
function accept_save()
{
	var accept_name = $.trim($('#accept_name').val());
	var province = $('#province').val();
	var city = $('#city').val();
	var area = $('#area').val();
	if(accept_name == '')
	{
		alert('请输入收货人的姓名!');
		return false;
	}
	if(province=='')
	{
		alert('请选择省份!');
		return false;
	}
	if(city=='')
	{
		alert('请选择城市!');
		return false;
	}
	if(area=='')
	{
		alert('请选择地区!');
		return false;
	}
	var address = $.trim($('#address').val());
	var mobile = $.trim($('#mobile').val());
	if(address=='')
	{
		alert('请输入地址!');
		return false;
	}
	if(mobile=='')
	{
		alert('请输入手机号码!');
		return false;
	}
	window.document.modelForm.submit();
}
function select_city(city,style)
{
	var arr = city.split(',');
	$.getJSON("<?php echo IUrl::creatUrl("/block/area_child");?>",{aid:arr[0],random:Math.random()}, function(json)
	{
		if(style==2)
		{
			var select_html = '<select name="city" id="city" onchange="select_city(this.value,3);">';
			select_html += '<option value="">请选择城市</option>';
			for( a in json)
			{
				if((json[a]['area_id']+','+json[a]['area_name'])==city_va)
				{
					select_html +='<option value="'+json[a]['area_id']+','+json[a]['area_name']+'" selected>'+json[a]['area_name']+'</option>';
				}
				else
				{
					select_html +='<option value="'+json[a]['area_id']+','+json[a]['area_name']+'">'+json[a]['area_name']+'</option>';
				}
			}
			delivery(arr[0]);
			select_html +='</select>';
			if($("#selec3").text()=='')$("#selec3").hide();
			$("#selec2").html(select_html);
		}
		if(style==3)
		{
			if(json.length>0)
			{
				var select_html = '<select name="area" id="area" onchange="select_city(this.value,4);">';
				select_html += '<option value="">请选择地区</option>';
				for( a in json)
				{
					if((json[a]['area_id']+','+json[a]['area_name'])==area_va)
					{
						select_html +='<option value="'+json[a]['area_id']+','+json[a]['area_name']+'" selected>'+json[a]['area_name']+'</option>';
						if(area_va!='')
						{
							select_city(area_va,4);
						}
					}
					else
					{
						select_html +='<option value="'+json[a]['area_id']+','+json[a]['area_name']+'">'+json[a]['area_name']+'</option>';
					}
				}
				select_html +='</select>';
				$("#selec3").show();
				$("#selec3").html(select_html);
			}
		}
	});
}
function delivery(id)
{
	//通过省份id查询出配送方式，并且传送总重量计算出运费,然后显示配送方式
	var weight = '<?php echo isset($weight)?$weight:"";?>';
	var distribution = '<?php echo isset($item['distribution'])?$item['distribution']:"";?>';
	var de_id = '';
	$.getJSON("<?php echo IUrl::creatUrl("/block/order_delivery");?>",{province:id,weight:weight,random:Math.random()},
		function(json){
		var html_va = '';
		for( a in json)
		{
			if(json[a]['if_delivery']==0)
			{
				if(json[a]['id']==distribution)
				{
					html_va = json[a]['price'];
					//计算
					var real_freight = '<?php echo isset($item['real_freight'])?$item['real_freight']:"";?>';
					var total = '<?php echo isset($item['order_amount'])?$item['order_amount']:"";?>';
					if(parseInt(html_va)!=parseInt(real_freight))
					{
						var total = parseInt(total)-parseInt(real_freight)+parseInt(html_va)
						$('#red2').html(total);
						$('#real_freight').html(html_va);
						$('#order_total').val(total);
						$('#freight_real').val(html_va);
						$('#not').html('该订单的运费发生变化，请注意订单总金额!');
					}
				}
			}
			else
			{
				if(json[a]['id']==distribution)
				{
					html_va = '该地区无法送到';
				}
			}
		}
		$("#freight").html(html_va);
	});
}
</script>

	</div>


	<div class="help m_10">
		<div class="cont clearfix">
			<?php $cat_list=array();?>
			<?php $query = new IQuery("help_category AS cat");$query->where = "position_foot = 1";$query->order = "sort asc,id desc";$query->limit = "5";$items = $query->find(); foreach($items as $key => $item){?>
			<?php $cat_list[$item['id']]=$item;?>
			<?php }?>
			<?php if(count($cat_list)){?>
				<?php $width=floor(100/count($cat_list))-1;?>
			<?php }?>

			<?php foreach($cat_list as $cat_id => $cat){?>
			<dl style="width:<?php echo isset($width)?$width:"";?>%">
     			<dt><a href="<?php echo IUrl::creatUrl("/site/help_list/id/$cat[id]");?>"><?php echo isset($cat['name'])?$cat['name']:"";?></a></dt>
     			<?php $query = new IQuery("help");$query->where = "cat_id = $cat_id";$query->order = "sort asc,id desc";$items = $query->find(); foreach($items as $key => $item){?>
					<dd><a href="<?php echo IUrl::creatUrl("/site/help/id/$item[id]");?>"><?php echo isset($item['name'])?$item['name']:"";?></a></dd>
				<?php }?>
      		</dl>
      		<?php }?>
		</div>
	</div>
	<?php echo $siteConfig->site_footer_code;?>

</div>
<script type='text/javascript'>
	//tabs的通用代码
	(function($){
		$(".tabs").each(function(i){
		    var parrent = $(this);
			$('.tabs_menu .node',this).each(function(j){
				var current=".node:eq("+j+")";
				$(this).bind('click',function(event){
					$('.tabs_menu .node',parrent).removeClass('current');
					$(this).addClass('current');
					$('.tabs_content>.node',parrent).css('display','none');
					$('.tabs_content>.node:eq('+j+')',parrent).css('display','block');
				});
			});
		});
	})(jQuery);

	//隔行换色
	$(".list_table tr::nth-child(even)").addClass('even');
	$(".list_table tr").hover(
		function () {
			$(this).addClass("sel");
		},
		function () {
			$(this).removeClass("sel");
		}
	);
    //用户中心导航条
    function menu_current()
    {
        var current = "<?php echo $this->getAction()->getId();?>";
        if(current == 'consult_old') current='consult';
        else if(current == 'isevaluation') current ='evaluation';
        else if(current == 'withdraw') current = 'account_log';
        var tmpUrl = "<?php echo IUrl::creatUrl("/ucenter/current");?>";
        tmpUrl = tmpUrl.replace("current",current);
        $('div.cont ul.list li a:[href^="'+tmpUrl+'"]').parent().addClass("current");
    }
    menu_current();
</script>
<script type='text/javascript' src='<?php echo IUrl::creatUrl("")."views/".$this->theme."/javascript/site.js";?>'></script>
<script type='text/javascript'>
var url_head = 	encodeURIComponent('<?php echo isset($iurl)?$iurl:"";?>');
	$('input:text[name="word"]').bind({
		keyup:function(){autoComplete(decodeURIComponent(url_head)+'index.php'+decodeURIComponent('%2F')+'site'+decodeURIComponent('%2F')+'autoComplete','<?php echo IUrl::creatUrl("/site/search_list");?>','<?php echo isset($site_config['auto_finish'])?$site_config['auto_finish']:"";?>');}
	});

	//购物车div层
	$('.mycart').hover(
		function(){
			showCart('<?php echo IUrl::creatUrl("/simple/showCart");?>');
		},
		function(){
			$('#div_mycart').hide('slow');
		}
	);
</script>
</body>
</html>
